Lambda - Dropping : Transforming Recursive Equations into Programswith Block

نویسندگان

  • Olivier Danvy
  • Ulrik P. Schultz
چکیده

Lambda-lifting a functional program transforms it into a set of recursive equations. We present the symmetric transformation: lambda-dropping. Lambda-dropping a set of recur-sive equations restores block structure and lexical scope. For lack of scope, recursive equations must carry around all the parameters that any of their callees might possibly need. Both lambda-lifting and lambda-dropping thus require one to compute a transitive closure over the call graph: for lambda-lifting: to establish the Def/Use path of each free variable (these free variables are then added as parameters to each of the functions in the call path); for lambda-dropping: to establish the Def/Use path of each parameter (parameters whose use occurs in the same scope as their deenition do not need to be passed along in the call path). Without free variables, a program is scope-insensitive. Its blocks are then free to oat (for lambda-lifting) or to sink (for lambda-dropping) along the vertices of the scope tree. recursive equations block sinking lambda dropping block oating O O parameter dropping block-structured program lambda lifting G G parameter lifting O O We believe lambda-lifting and lambda-dropping are interesting per se, both in principle and in practice, but our prime application is partial evaluation: except for Malmkjjr and rbbk's case study presented at PEPM'95, most poly-variant specializers for procedural programs operate on re-cursive equations. To this end, in a pre-processing phase, they lambda-lift source programs into recursive equations. As a result, residual programs are also expressed as recur-sive equations, often with dozens of parameters, which most compilers do not handle eeciently. Lambda-dropping in a post-processing phase restores their block structure and lexical scope thereby signiicantly reducing both the compile time and the run time of residual programs. source block-structured program lambda-lifting / / source recursive equations partial evaluation residual block-structured program residual recursive equations lambda-dropping o o 1 Introduction and Motivation Block structure and lexical scope stand at the foundation of functional programming, but are they so much in everyday use? Evidence says that they are not. Consider the standard append function deened as a recursive equation:

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An Extensional Characterization of Lambda-Lifting and Lambda-Dropping

Lambda-lifting and lambda-dropping respectively transform a blockstructured functional program into recursive equations and vice versa. Lambda-lifting was developed in the early 80’s, whereas lambda-dropping is more recent. Both are split into an analysis and a transformation. Published work, however, has only concentrated on the analysis parts. We focus here on the transformation parts and mor...

متن کامل

Improved Graph-Based Lambda Lifting

Lambda lifting is a technique for transforming a program with local function definitions into a program consisting only of global function definitions. The best known lambda lifting algorithm computes the minimal set of extraneous parameters needed by each function in O(n) steps by solving a system of set equations which are recursive if the functions in the program are mutually recursive. Mutu...

متن کامل

Lambda Lifting: Treansforming Programs to Recursive Equations

y Abstract Lambda lifting is a technique for transforming a functional program with local function deenitions, possibly with free variables in the function deenitions, into a program consisting only of global function (combinator) deenitions which will be used as rewrite rules. Diierent ways of doing lambda lifting are presented, as well as reasons for rejecting or selecting the method used in ...

متن کامل

Theory of Linear Equations Applied to Program Transformation

In this paper is presented a technique for transforming a class of recursive equations called linear equations into iterative equations. Linear equations are characterized by involving at the most one recursive call for any invocation. In contrast to the conventional techniques, the scheme of program transformation presented here involves finding the solution of the given linear equation and tr...

متن کامل

Numerical solution of higher index DAEs using their IAE's structure: Trajectory-prescribed path control problem and simple pendulum

In this paper, we solve higher index differential algebraic equations (DAEs) by transforming them into integral algebraic equations (IAEs). We apply collocation methods on continuous piece-wise polynomials space to solve the obtained higher index IAEs. The efficiency of the given method is improved by using a recursive formula for computing the integral part. Finally, we apply the obtained algo...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995